; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output                           | FileCheck %s --check-prefixes=ALL,X64
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe             | FileCheck %s --check-prefixes=ALL,X64-MOVBE
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X64-FASTMOVBE

; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output                           | FileCheck %s --check-prefixes=ALL,X32
; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe             | FileCheck %s --check-prefixes=ALL,X32-MOVBE
; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X32-FASTMOVBE

declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
declare i64 @llvm.bswap.i64(i64)
declare i128 @llvm.bswap.i128(i128)

define i16 @var_load_bswap_i16(ptr %src) {
; X64-LABEL: 'var_load_bswap_i16'
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
; X64-MOVBE-LABEL: 'var_load_bswap_i16'
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
; X64-FASTMOVBE-LABEL: 'var_load_bswap_i16'
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
; X32-LABEL: 'var_load_bswap_i16'
; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
; X32-MOVBE-LABEL: 'var_load_bswap_i16'
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
; X32-FASTMOVBE-LABEL: 'var_load_bswap_i16'
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
  %a = load i16, ptr %src, align 1
  %bswap = call i16 @llvm.bswap.i16(i16 %a)

  ret i16 %bswap
}
define i16 @var_load_bswap_i16_extrause(ptr %src, ptr %clobberdst) {
; ALL-LABEL: 'var_load_bswap_i16_extrause'
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i16 %a, 2
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i16 %a2, ptr %clobberdst, align 1
; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
  %a = load i16, ptr %src, align 1
  %bswap = call i16 @llvm.bswap.i16(i16 %a)

  %a2 = shl i16 %a, 2 ; incur an extra use to the load
  store i16 %a2, ptr %clobberdst, align 1

  ret i16 %bswap
}

define i32 @var_load_bswap_i32(ptr %src) {
; X64-LABEL: 'var_load_bswap_i32'
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
; X64-MOVBE-LABEL: 'var_load_bswap_i32'
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
; X64-FASTMOVBE-LABEL: 'var_load_bswap_i32'
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
; X32-LABEL: 'var_load_bswap_i32'
; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
; X32-MOVBE-LABEL: 'var_load_bswap_i32'
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
; X32-FASTMOVBE-LABEL: 'var_load_bswap_i32'
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
  %a = load i32, ptr %src, align 1
  %bswap = call i32 @llvm.bswap.i32(i32 %a)

  ret i32 %bswap
}
define i32 @var_load_bswap_i32_extrause(ptr %src, ptr %clobberdst) {
; ALL-LABEL: 'var_load_bswap_i32_extrause'
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i32 %a, 2
; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i32 %a2, ptr %clobberdst, align 1
; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
  %a = load i32, ptr %src, align 1
  %bswap = call i32 @llvm.bswap.i32(i32 %a)

  %a2 = shl i32 %a, 2 ; incur an extra use to the load
  store i32 %a2, ptr %clobberdst, align 1

  ret i32 %bswap
}

define i64 @var_load_bswap_i64(ptr %src) {
; X64-LABEL: 'var_load_bswap_i64'
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X64-MOVBE-LABEL: 'var_load_bswap_i64'
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X64-FASTMOVBE-LABEL: 'var_load_bswap_i64'
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X32-LABEL: 'var_load_bswap_i64'
; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X32-MOVBE-LABEL: 'var_load_bswap_i64'
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X32-FASTMOVBE-LABEL: 'var_load_bswap_i64'
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
  %a = load i64, ptr %src, align 1
  %bswap = call i64 @llvm.bswap.i64(i64 %a)

  ret i64 %bswap
}
define i64 @var_load_bswap_i64_extrause(ptr %src, ptr %clobberdst) {
; X64-LABEL: 'var_load_bswap_i64_extrause'
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, ptr %clobberdst, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X64-MOVBE-LABEL: 'var_load_bswap_i64_extrause'
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, ptr %clobberdst, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X64-FASTMOVBE-LABEL: 'var_load_bswap_i64_extrause'
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, ptr %clobberdst, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X32-LABEL: 'var_load_bswap_i64_extrause'
; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, ptr %clobberdst, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X32-MOVBE-LABEL: 'var_load_bswap_i64_extrause'
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, ptr %clobberdst, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X32-FASTMOVBE-LABEL: 'var_load_bswap_i64_extrause'
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, ptr %clobberdst, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
  %a = load i64, ptr %src, align 1
  %bswap = call i64 @llvm.bswap.i64(i64 %a)

  %a2 = shl i64 %a, 2 ; incur an extra use to the load
  store i64 %a2, ptr %clobberdst, align 1

  ret i64 %bswap
}

define i128 @var_load_bswap_i128(ptr %src) {
; X64-LABEL: 'var_load_bswap_i128'
; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X64-MOVBE-LABEL: 'var_load_bswap_i128'
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X64-FASTMOVBE-LABEL: 'var_load_bswap_i128'
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X32-LABEL: 'var_load_bswap_i128'
; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X32-MOVBE-LABEL: 'var_load_bswap_i128'
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X32-FASTMOVBE-LABEL: 'var_load_bswap_i128'
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
  %a = load i128, ptr %src, align 1
  %bswap = call i128 @llvm.bswap.i128(i128 %a)

  ret i128 %bswap
}
define i128 @var_load_bswap_i128_extrause(ptr %src, ptr %clobberdst) {
; X64-LABEL: 'var_load_bswap_i128_extrause'
; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, ptr %clobberdst, align 1
; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X64-MOVBE-LABEL: 'var_load_bswap_i128_extrause'
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, ptr %clobberdst, align 1
; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X64-FASTMOVBE-LABEL: 'var_load_bswap_i128_extrause'
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, ptr %clobberdst, align 1
; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X32-LABEL: 'var_load_bswap_i128_extrause'
; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, ptr %clobberdst, align 1
; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X32-MOVBE-LABEL: 'var_load_bswap_i128_extrause'
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, ptr %clobberdst, align 1
; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X32-FASTMOVBE-LABEL: 'var_load_bswap_i128_extrause'
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, ptr %clobberdst, align 1
; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
  %a = load i128, ptr %src, align 1
  %bswap = call i128 @llvm.bswap.i128(i128 %a)

  %a2 = shl i128 %a, 2 ; incur an extra use to the load
  store i128 %a2, ptr %clobberdst, align 1

  ret i128 %bswap
}
